#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
typedef unsigned long long ull;
ull m,n;
int main() {
	while (cin>>m>>n) {
		if (m==0&&n==0) break;
		if (m>n) swap(m,n);
		ull ans=m*n*(n-1)/2+n*m*(m-1)/2+(n-m+1)*m*(m-1);
		ans+=(m-1)*(m)*(2*m-1)/3-(m-1)*m;
		cout<<2*ans<<endl;
	}
	return 0;
} 
